﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Windows.Storage;
using SNSComponentSample.WP8.Resources;

namespace SNSComponentSample.WP8
{
    public partial class MainPage : PhoneApplicationPage
    {  

        SNSComponent.SNSProvider.IProvider pro = new SNSComponent.SNSProvider.SinaProvider("", "", new Uri(""), "SinaWeibo");
        
        
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
            pro.GetTokenComplated += pro_GetTokenComplated;
            pro.TokenChanged += pro_TokenChanged;
        }

        void pro_TokenChanged(object sender, EventArgs e)
        {
        }

        void pro_GetTokenComplated(object sender, SNSComponent.SNSProvider.ResultDataEventArgs e)
        {
        }

        private  void Button_Click(object sender, RoutedEventArgs e)
        {
            pro.GetToken();

        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Microsoft.Phone.Tasks.PhotoChooserTask task = new Microsoft.Phone.Tasks.PhotoChooserTask();
            task.Completed += task_Completed;

            task.Show();
        }

        async void task_Completed(object sender, Microsoft.Phone.Tasks.PhotoResult e)
        {
            SNSComponent.SNSProvider.ResultData data = await pro.ShareStatus("sdfsdfs");

        }

        

        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();

        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
    }
}